'use strict'
import React from "react";
import {render} from 'react-dom';
import FileUpload from 'react-fileupload';
//引入依赖文件
import MMALL_COM from 'util/comm.jsx';

var _comm = new MMALL_COM();
class FileUploader extends React.Component{
    constructor(props){
        super(props);
        this.state={

        }
    }
    componentDidMount(){

    }
    render() {
        /*set properties*/
        const options={
            baseUrl         : _comm.getServerHost('/manage/product/upload.do'),
            fileFieldName   : 'upload_file',
            accept          : 'image/gif,image/jpeg,image/jpg,image/png',
            chooseAndUpload : true,
            uploadSuccess   : this.props.onSuccess,
            uploadError     : this.props.onError
        }
        /*Use FileUpload with options*/
        /*Set two dom with ref*/
        return (
            <FileUpload options={options}>
                <button ref="chooseAndUpload">上传图片</button>
            </FileUpload>
        )           
    }
}
export default FileUploader;
